using ProduceBasicData.Api.DTO;
using ProduceBasicData.Domain.CodeGeneration;

namespace ProduceBasicData.Api.Services
{
    /// <summary>
    /// 编码规则管理服务接口
    /// </summary>
    public interface ICodeRuleService
    {
        /// <summary>
        /// 获取指定实体的编码规则
        /// </summary>
        /// <param name="classFullName">实体完整限定名</param>
        /// <returns>编码规则</returns>
        Task<CodeRule?> GetRuleByEntityAsync(string classFullName);

        /// <summary>
        /// 保存编码规则
        /// </summary>
        /// <param name="rule">编码规则</param>
        /// <returns>保存结果</returns>
        Task<bool> SaveRuleAsync(CodeRule rule);

        /// <summary>
        /// 更新编码规则
        /// </summary>
        /// <param name="rule">编码规则</param>
        /// <returns>更新结果</returns>
        Task<bool> UpdateRuleAsync(CodeRule rule);

        /// <summary>
        /// 删除编码规则
        /// </summary>
        /// <param name="id">规则ID</param>
        /// <returns>删除结果</returns>
        Task<bool> DeleteRuleAsync(int id);

        /// <summary>
        /// 获取所有编码规则
        /// </summary>
        /// <returns>编码规则列表</returns>
        Task<List<CodeRule>> GetAllRulesAsync();

        /// <summary>
        /// 根据规则自动生成编码
        /// </summary>
        /// <param name="classFullName">实体完整限定名</param>
        /// <returns>生成的编码</returns>
        Task<string?> AutoGenerateCodeAsync(string classFullName);
    }
}
